package com.ruizhong.centercontroll.controller;

import com.ruizhong.centercontroll.entity.TButton;
import com.ruizhong.centercontroll.service.TButtonService;
import com.ruizhong.centercontroll.util.Result;
import com.ruizhong.centercontroll.util.ResultCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/button/api")
@CrossOrigin
public class TButtonController {

    @Autowired
    private TButtonService tButtonService;

    @PostMapping("/saveNewButton/{pageId}")
    public Result saveNewButton(@RequestBody TButton tButton, @PathVariable(value = "pageId") Integer pageId){
        tButton.setPageId(pageId);
        tButtonService.saveNewButton(tButton);
        return new Result(ResultCode.success,"保存成功",null);
    }

}
